Skip to content

fix(server): dedupe remote collection requests - #535

Open
onmax wants to merge 1 commit into
nuxt:mainfrom
onmax:fix/dedupe-remote-collection-requests
Open

fix(server): dedupe remote collection requests#535
onmax wants to merge 1 commit into
nuxt:mainfrom
onmax:fix/dedupe-remote-collection-requests

Conversation

@onmax

@onmax onmax commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #534.

📚 Description

Concurrent requests for different icons in a cold remote collection each download the whole collection. This caches the pending fetch so callers share it, and clears failed fetches or JSON parses so later requests can retry.

cold caller A ─┐
cold caller B ─┼─> one pending collection fetch ─> resolved cache
cold caller C ─┘

fetch/JSON error ─> clear pending cache ─> later caller retries

With 20 overlapping requests for one 49,940-byte collection, the production Node repro goes from 20 downloads / 998,800 bytes to 1 / 49,940 bytes. Sharing is per process and applies to remote server bundles.

Repro: Before · After, with a pnpm patch. Runs locally against a production Node build.

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/icon@535

commit: fc64460

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9d79f78f-b7eb-4f9f-b4ca-2ceebe5bd7a0

📥 Commits

Reviewing files that changed from the base of the PR and between b878f5b and fc64460.

📒 Files selected for processing (2)
  • src/bundle-server.ts
  • test/server-bundle.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The server bundle now caches the in-flight promise for each remote collection. Concurrent calls share one fetch. Rejected fetches and JSON parsing failures clear the cache and allow retries. Falsy collection results are not retained. New tests load the generated server bundle and verify concurrent deduplication, successful caching, failure retries, and retries after falsy responses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to fc644

Remote icon collections now share concurrent downloads while retaining caching and retry behavior after failed or falsy responses. The covered behavior is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #534 by caching the pending fetch, sharing it across concurrent callers, preserving resolved caching, and clearing the cache after fetch, JSON, or falsey-result fail…
Out of Scope Changes check ✅ Passed The changes are limited to the remote collection cache fix and targeted tests for concurrency, caching, and retry behavior. No unrelated code changes are identified.
Title check ✅ Passed The title clearly and concisely describes the main change: deduplicating concurrent remote collection requests in the server bundle.
Description check ✅ Passed The description directly explains the duplicate-download problem, the pending-fetch cache, retry behavior, performance impact, and validation scope.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote server bundle duplicates concurrent collection downloads

1 participant